// import 'package:gin_app/chats/onlineList.dart';
// import 'package:gin_app/chats/recommend_list.dart';

import 'package:flutter/material.dart';

String DynamicTime(createdAt){
  String str='';

  int time_get=createdAt*1000;
  int time_now=new DateTime.now().millisecondsSinceEpoch;

  if((time_now-time_get)<3600000){
    String str1=((time_now-time_get)/60000).truncate().toString();
    if(int.parse(str1)>0){
      str1=str1;
    }else{
      str1='1';
    }
    str=str1 + '分钟前';
  }else if((time_now-time_get)>3600000 && (time_now-time_get)<86400000){
    String str1=((time_now-time_get)/3600000).truncate().toString();
    if(int.parse(str1)>0){
      str1=str1;
    }else{
      str1='1';
    }
    str=str1 + '小时前';
  }else if((time_now-time_get)>86400000){
    String str1=((time_now-time_get)/86400000).truncate().toString();
    if(int.parse(str1)>0){
      str1=str1;
    }else{
      str1='1';
    }
    str=str1 + '天前';
  }

  return str;
}